from pyecharts import options as opts
from pyecharts.charts import Bar
import random

l1 = ['星期一', '星期二', '星期三', '星期四', '星期五', '星期七', '星期日']
l2 = [100, 200, 300, 400, 500, 400, 300]
bar = (
    Bar()
        .add_xaxis(l1)
        .add_yaxis("l2", l2)
        .set_global_opts(title_opts=opts.TitleOpts(title="标记线柱状图"))
        .set_series_opts(
        label_opts=opts.LabelOpts(is_show=False),
        markline_opts=opts.MarkLineOpts(
            data=[
                opts.MarkLineItem(type_="min", name="最小值"),
                opts.MarkLineItem(type_="max", name="最大值"),
                opts.MarkLineItem(type_="average", name="平均值"),
            ]
        ),
    )
)
bar.render(path='6.显示最大值、最小值和平均值-标记线.html')
